You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add an optional workflow that runs the CUDA GPU kernel test on a simulated H100 - #1884
CI.yml compiles the CUDA build ("Test on linux w/ CUDA") but cannot run it, because the hosted runners have no GPU. The GPU code path is already tested on an emulated device through the ROCm HIP-CPU jobs ("Test 5b" and "Test 6b"), but those run the HIP build. This adds a separate, optional workflow .github/workflows/gpu-sim.yml that runs the same test as "Test 5b" (homogeneous acoustic kernel, GPU: true) on the CUDA build, on a simulated NVIDIA H100 using PantheonSim (no GPU needed). I am the author of PantheonSim, so please weigh this accordingly.
The job is modelled on linuxTest_5b and uses the existing .github/scripts/run_tests.sh unchanged. It does not touch any source file or CI.yml, and is not meant to be a required check. A simulator cannot reproduce hardware-specific behavior or timing, so it complements real-GPU testing and does not replace it.
What it does:
installs the CUDA 13.0 toolkit and the simulated H100 (pantheongpu/setup-pantheonsim, pinned by SHA), plus gfortran and Open MPI from apt
configures with --with-cuda=cuda12, which selects GENCODE_90 (sm_90 plus compute_90 PTX); the simulator runs the PTX. cuda13, as in the compile job, selects the Blackwell target, which an H100 cannot load. The Makefile already links --cudart=shared, which the simulator needs.
passes FLAGS_CHECK equal to the gfortran default from flags.guess minus -ffpe-trap=invalid,zero,overflow. The simulator runs device code on host threads, which inherit the trap mask, so the first inf/NaN in a kernel kills the solver with SIGFPE. This does not happen on a real GPU; it is a simulator limitation, not a SPECFEM problem, and the override can be dropped once the simulator handles it.
sets IMAIN = ISTANDARD_OUTPUT as run_build.sh does, builds only xdecompose_mesh, xgenerate_databases, xspecfem3D and xcombine_vol_data_vtk with -j3
runs TESTDIR=EXAMPLES/applications/homogeneous_acoustic/ RUN_KERNEL=true GPU=true ./.github/scripts/run_tests.sh under vgpu run, so the rho and kappa kernel maxima are checked against REF_KERNEL/ (0.1%), for the plain run and again with UNDO_ATTENUATION_AND_OR_PML
runs on manual dispatch and on pull requests to devel that touch src/, setup/, the configure/Makefile inputs, this example, run_tests.sh or the workflow, with a concurrency group that cancels superseded runs
Measured:
Run on my fork: https://github.com/saqibkh/specfem3d/actions/runs/43237758263 . It passed: both kernel checks printed "testing kernel values: all good" (rho 1.818e-10 and kappa 3.608e-12 in the plain run and in the UNDO_ATTENUATION_AND_OR_PML rerun), and the script ended with "all good".
The job took about 49 minutes: about 19.5 for the simulator and toolkit setup on a cold cache (shorter once cached), 2 for the build and about 27 for the test step.
Locally the simulated run gives rho 1.81843957E-10 and kappa 3.60817235E-12 (relative differences 1.5e-07 and 2.9e-06), and 1.81844081E-10 / 3.60816780E-12 with UNDO_ATTENUATION_AND_OR_PML. The same test built for sm_80 on a real RTX 3060 gives relative differences of 2.3e-07 / 4.2e-07 and 9.1e-07 / 3.4e-06.
As a check that the test notices wrong GPU results, I scaled p_dot_dot by 1.01 in kernel_3_acoustic_cuda_device: the kernel check then fails (rho 2.1E+12 against 1.8E-10) and the job exits 1.
Not covered:
Only the homogeneous acoustic kernel test (one process, NPROC = 1). The "6b" halfspace kernel test also works under the simulator with mpirun -np 4 (each rank gets its own simulated device; a 20-step check ran cleanly), but at 700 steps per run with four ranks on a 4-core runner it would take well over an hour, so I left it out.
Elastic, poroelastic, PML, fault and LTS kernels, the seismogram comparisons (REF_SEIS) and other examples are not run on the GPU path.
Only one GPU architecture (H100) and one CUDA version (13.0).
The red Azure checks (SPECFEM.specfem3d (Compilation Default GCC) and (Compilation CUDA 12 latest)) don't come from this PR, which only adds .github/workflows/gpu-sim.yml. Azure never reads that file. Both jobs use vmImage: 'ubuntu-latest', which moved to Ubuntu 26.04 on October 19 (the job log has a "Remote machine provider issue" note about it). On 26.04 (GCC 15, newer OpenMPI), configure --with-mpi now stops at configure: error: MPI header not found; try setting MPI_INC. The ubuntu-22.04 jobs in the same run passed. The last Azure run on devel was on October 9, before the image change, so I'd expect devel to fail the same way on its next run. Pinning those two jobs to ubuntu-24.04, or setting MPI_INC for 26.04, should fix it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI.ymlcompiles the CUDA build ("Test on linux w/ CUDA") but cannot run it, because the hosted runners have no GPU. The GPU code path is already tested on an emulated device through the ROCm HIP-CPU jobs ("Test 5b" and "Test 6b"), but those run the HIP build. This adds a separate, optional workflow.github/workflows/gpu-sim.ymlthat runs the same test as "Test 5b" (homogeneous acoustic kernel,GPU: true) on the CUDA build, on a simulated NVIDIA H100 using PantheonSim (no GPU needed). I am the author of PantheonSim, so please weigh this accordingly.The job is modelled on
linuxTest_5band uses the existing.github/scripts/run_tests.shunchanged. It does not touch any source file orCI.yml, and is not meant to be a required check. A simulator cannot reproduce hardware-specific behavior or timing, so it complements real-GPU testing and does not replace it.What it does:
pantheongpu/setup-pantheonsim, pinned by SHA), plus gfortran and Open MPI from apt--with-cuda=cuda12, which selectsGENCODE_90(sm_90 plus compute_90 PTX); the simulator runs the PTX.cuda13, as in the compile job, selects the Blackwell target, which an H100 cannot load. The Makefile already links--cudart=shared, which the simulator needs.FLAGS_CHECKequal to the gfortran default fromflags.guessminus-ffpe-trap=invalid,zero,overflow. The simulator runs device code on host threads, which inherit the trap mask, so the first inf/NaN in a kernel kills the solver with SIGFPE. This does not happen on a real GPU; it is a simulator limitation, not a SPECFEM problem, and the override can be dropped once the simulator handles it.IMAIN = ISTANDARD_OUTPUTasrun_build.shdoes, builds onlyxdecompose_mesh,xgenerate_databases,xspecfem3Dandxcombine_vol_data_vtkwith-j3TESTDIR=EXAMPLES/applications/homogeneous_acoustic/ RUN_KERNEL=true GPU=true ./.github/scripts/run_tests.shundervgpu run, so the rho and kappa kernel maxima are checked againstREF_KERNEL/(0.1%), for the plain run and again withUNDO_ATTENUATION_AND_OR_PMLdevelthat touchsrc/,setup/, the configure/Makefile inputs, this example,run_tests.shor the workflow, with a concurrency group that cancels superseded runsMeasured:
p_dot_dotby 1.01 inkernel_3_acoustic_cuda_device: the kernel check then fails (rho 2.1E+12 against 1.8E-10) and the job exits 1.Not covered:
mpirun -np 4(each rank gets its own simulated device; a 20-step check ran cleanly), but at 700 steps per run with four ranks on a 4-core runner it would take well over an hour, so I left it out.REF_SEIS) and other examples are not run on the GPU path.